from base import *

########## TEST SETTINGS
TEST_RUNNER = 'discover_runner.DiscoverRunner'
TEST_DISCOVER_TOP_LEVEL = SITE_ROOT
TEST_DISCOVER_ROOT = SITE_ROOT
TEST_DISCOVER_PATTERN = "test_*.py"
########## TEST DATABASE

ADMINS = (
    ('Mao Fan', 'maofan@panguso.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'financial_daily_test',
        'USER': 'search',
        'PASSWORD': get_env_variable('FINANCIAL_DAILY_DB_KEY_TEST'),
        'HOST': '10.10.66.46',
        'PORT': '3306',
    },
    'cninfo': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'cninfo',
        'USER': 'root',
        'PASSWORD': get_env_variable('CNINFO_DB_KEY'),
        'HOST': '10.10.66.46',
        'PORT': '3306',
    }
}

# For quick testing only 
ALLOWED_HOSTS = ['*']

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'Asia/Shanghai'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'cn-zh'

INSTALLED_APPS += (
    'discover_runner',
)

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'filename': normpath(join(get_env_variable('FINANCIAL_DAILY_LOG_PATH'), 'debug.log')),
        },
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django': {
            'handlers': ['file', 'mail_admins'],
            'level': 'DEBUG',
        },
    }
}

########## PROJECT-WISE CONFIGURATION

# Word segmentation configs
WORD_SEG_SERVICE_URL = '10.10.66.206:8080'
WORD_SEG_SERVICE_NAME = '/wordsegment-3.0/wordsegment'
WORD_SEG_LEX_TEXT = 'lexemeText'
WORD_SEG_TYPE_ALL = 0
WORD_SEG_TYPE_BASIC = 2
WORD_SEG_TYPE_PHRASE = 4

# Redis configs
REDIS_HOST = '10.10.0.242'
REDIS_PORT = 6379
REDIS_DB_NO = 0
REDIS_DATA_KEY_DELIMITER = '.'

# Redis QA configs
QA_REDIS_HOST = '10.10.0.242'
QA_REDIS_PORT = 6381
QA_REDIS_DB_NO = 0

########## END PROJECT-WISE CONFIGURATION
